import request from "@/utils/request";

//渲染商品管理页数据
const cartsList = (params = {}) => {
  return request.get("/test", { params });
};

//登录接口
const LoginApi = (params = {}) => {
  return request.post("/api/login", params);
};

//注册接口
const RegisterApi = (params = {}) => {
  return request.post("/api/register", params);
};

//获取个人信息
const UserinfoApi = (params = {}) => {
  return request.get("/user/userinfo", params);
};

//修改个人信息
const UserinfoEditApi = (params = {}) => {
  return request.post("/user/edit", params);
};

//删除个人信息
const UserinfoDeleteApi = (params = {}) => {
  return request.post("/user/delete", params);
};

//新增个人信息
const UserinfoAddApi = (params = {}) => {
  return request.post("/user/add", params);
};

//获取文章列表
const ArticleListApi = (params) => {
  return request.get("/article/list", { params });
};

//删除文章信息
const ArticleDeleteApi = (params = {}) => {
  return request.post("/article/delete", params);
};

//获取文章详情
const ArticleDetailApi = (id) => {
  return request.get("/article/detail", { params: { id } });
};

//新增文章
const ArticleAddApi = (params = {}) => {
  return request.post("/article/add", params);
};

//修改文章信息
const ArticleEditApi = (params = {}) => {
  return request.post("/article/edit", params);
};

//文章搜索接口
const ArticleSearchApi = (params) => {
  return request.get("/article/search", { params });
};

//上传图片接口
const imageUpload = (params = {}) => {
  return request.post("/upload/up", params);
};

//获取轮播图列表
const BannerListApi = (params) => {
  return request.get("/banner/bannerlist", { params });
};

//删除轮播图
const BannerDeleteApi = (params = {}) => {
  return request.post("/banner/bannerdelete", params);
};

//获取轮播图详情
const BannerDetailApi = (id) => {
  return request.get("/banner/bannerdetail", { params: { id } });
};

//修改轮播图信息
const BannerEditApi = (params = {}) => {
  return request.post("/banner/banneredit", params);
};

//新增轮播图
const BannerAddApi = (params = {}) => {
  return request.post("/banner/banneradd", params);
};

//获取所有用户
const alluserListApi = (params) => {
  return request.get("/user/alluser", { params });
}

//获取单个用户的详情
const userDetailEvery = (id) => {
  return request.get("/user/everyuserinfo", { params: { id } });
}

//文章搜索接口
const UserSearchApi = (params) => {
  return request.get("/user/searchuserinfo", { params });
};

//查看有多少用户
const userCountApi = (params) => {
  return request.get("/echarts/ecahrtsUserNumber", { params });
}

//查看文学的数量
const articleOneCountApi = (params) => {
  return request.get("/echarts/ecahrtsArticleOne", { params });
}

//查看理学的数量
const articleTwoCountApi = (params) => {
  return request.get("/echarts/ecahrtsArticleTwo", { params });
}

//查看商品列表
const goodsListApi = (params) => {
  return request.get("/goods/list", { params });
};

//增加商品
const goodsAddApi = (params = {}) => {
  return request.post("/goods/add", params);
};

//修改商品
const goodsEditApi = (params = {}) => {
  return request.post("/goods/update", params);
};

//商品的详情
const goodsDetailApi = (id) => {
  return request.get("/goods/detail", { params: { id } });
};

//删除商品
const goodsDeleteApi = (params = {}) => {
  return request.post("/goods/delete", params);
};

//订单列表
const orderListApi = (params) => {
  return request.get("/order/orderList", { params });
}

//图书列表
const bookListApi = (params) => {
  return request.get("/book/getBookList", { params });
}

//新增图书
const bookAddApi = (params = {}) => {
  return request.post("/book/addBook", params);
};

//修改图书
const bookEditApi = (params = {}) => {
  return request.post("/book/updateBook", params);
};

//图书详情
const bookDetailApi = (id) => {
  return request.get("/book/getBookDetail", { params: { id } });
};

//删除图书
const bookDeleteApi = (params = {}) => {
  return request.post("/book/deleteBook", params);
};

//音乐列表
const musicListApi = (params) => {
  return request.get("/music/list", { params });
}

//新增音乐
const musicAddApi = (params = {}) => {
  return request.post("/music/add", params);
};

//修改音乐
const musicUpdateApi = (params = {}) => {
  return request.post("/music/update", params);
};

//删除音乐
const musicDeleteApi = (params = {}) => {
  return request.post("/music/delete", params);
};

//音乐详情
const musicDetailApi = (id) => {
  return request.get("/music/detail", { params: { id } });
};

//导出
export {
  cartsList,
  LoginApi,
  RegisterApi,
  UserinfoApi,
  UserinfoEditApi,
  UserinfoDeleteApi,
  UserinfoAddApi,
  ArticleListApi,
  ArticleDeleteApi,
  ArticleDetailApi,
  ArticleEditApi,
  ArticleSearchApi,
  ArticleAddApi,
  imageUpload,
  BannerListApi,
  BannerDeleteApi,
  BannerDetailApi,
  BannerEditApi,
  BannerAddApi,
  alluserListApi,
  userDetailEvery,
  UserSearchApi,
  userCountApi,
  articleOneCountApi,
  articleTwoCountApi,
  goodsListApi,
  goodsAddApi,
  goodsEditApi,
  goodsDetailApi,
  goodsDeleteApi,
  orderListApi,
  bookListApi,
  bookAddApi,
  bookEditApi,
  bookDetailApi,
  bookDeleteApi,
  musicListApi,
  musicAddApi,
  musicUpdateApi,
  musicDeleteApi,
  musicDetailApi
};
